import java.util.Arrays;

public class ArraysTest4 {
    public static void main(String[] args) {
        int[] arr = {1, 5, 9, 23, 43, 58, 96};

        //复制arr数组的元素，得到一个新数组
//        int[] nums = Arrays.copyOf(arr, 5);
//        int[] nums = Arrays.copyOf(arr, arr.length);
        int[] nums = Arrays.copyOf(arr, arr.length*2);

        System.out.println("arr数组：" + Arrays.toString(arr));
        //arr数组：[1, 5, 9, 23, 43, 58, 96]
        System.out.println("nums数组：" + Arrays.toString(nums));
        //nums数组：[1, 5, 9, 23, 43]
        //nums数组：[1, 5, 9, 23, 43, 58, 96]
        //nums数组：[1, 5, 9, 23, 43, 58, 96, 0, 0, 0, 0, 0, 0, 0]
    }
}
